﻿using Firefly.Framework.Windows.Forms;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace Firefly.Framework.Windows.ContentReaders
{
    public class FormContentReader : ContentTypeReader<Form>
    {
        protected override Form Read(ContentReader input, Form existingInstance)
        {
            Form result = new Form();
            result.DeserializeContent(input);

            if (result.ClientAreaOffset == Vector4.Zero)
            {
                result.ClientAreaOffset = WindowsService.Instance.Theme.Form.ClientAreaOffset;
            }

            if (result.TextOffset == Vector4.Zero)
            {
                result.TextOffset = WindowsService.Instance.Theme.Form.TextOffset;
            }

            return result;
        }
    }
}
